home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 468 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: solon.com!not-for-mail
  2. From: marino.ladavac@aut.alcatel.at (Marino Ladavac)
  3. Newsgroups: comp.lang.c,comp.lang.c.moderated
  4. Subject: Re: Leading and Trailing Blanks
  5. Followup-To: comp.lang.c,comp.lang.c.moderated
  6. Date: 5 Jan 1996 09:54:15 -0600
  7. Organization: Alcatel Austria AG
  8. Sender: clc@solutions.solon.com
  9. Approved: clc@solutions.solon.com
  10. Message-ID: <4cjhj7$fbi@solutions.solon.com>
  11. References: <4chh1b$685@solutions.solon.com>
  12. NNTP-Posting-Host: solutions.solon.com
  13. X-Newsreader: TIN [version 1.2 PL2]
  14.  
  15.  
  16. Casey Claiborne (mskc@io.com) wrote:
  17.  
  18. : Hello -
  19. :     I am wondering if anyone out there has a program (or knows of one)
  20. : that allows one to strip leading and trailing blanks from a string. 
  21. : ex:
  22.  
  23. :     char test[20];
  24. :     strcpy(test,"  TESTING  ");
  25. :     printf("%s", test);
  26.  
  27. : will produce an output like
  28. :   TESTING  
  29.  
  30. : that has blanks at the beginning of "TESTING". I would like to 
  31. : have the following result
  32.  
  33. : TESTING
  34.  
  35. : that has no leading blanks.
  36.  
  37. : I would *greatly* appreciate any type of help or hints in working with
  38. : this.
  39.  
  40. : I'll be looking out here, but e-mails are also appreciated :)
  41.  
  42. Even though this has nothing at all to do with C language, if you have
  43. the source (I assume that you do,) check out regex find and replace of
  44. your editor.
  45.  
  46. Even if you don't have the source, you might be able to use emacs to
  47. interactively regex edit the binary.
  48.  
  49. If your editor does not do regex magic, perl has been ported to a vast
  50. majority of platforms (cf. comp.lang.perl.)
  51.  
  52. Hope this helps,
  53.  
  54. /Alby
  55.